//
//
//
//
//
//
// NetAddr.h

#ifndef _NET_ADDR_H_
#define _NET_ADDR_H_

#include "common.h"
#include "datatypes.h"
#include <string>

// Only support IP V4 now

class NetAddr
{
	public:
		enum FAMILY
		{
			_AF_NONE = 0x00000000,
			_AF_INET = AF_INET,
			_AF_INET6 = AF_INET6,
			_AF_ROUTE = AF_ROUTE,
		};

	public:
		NetAddr();
		NetAddr(U32 afamily, S32 port /*local byte order*/,
				const std::string& ip);
		NetAddr(U32 afamily, S32 port /*local byte order*/,
				S32 ip);
		NetAddr(const NetAddr& other);
		~NetAddr();

		NetAddr& operator=(const NetAddr& other);
		bool Valide() const;
		std::string AsString() const;
		friend class TCPSocket;
	private:
		U32 _afamily;
		U32 _port;
		S32 _ip;

		bool _valide;
};

#endif // _NET_ADDR_H_
